package com.comba.nutz.boot.auth.server.entity;

import lombok.Getter;
import lombok.Setter;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.One;
import org.nutz.dao.entity.annotation.Table;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
 * 系统账户信息表
 *
 * @author lizhiyong
 */
@Table("system_account")
@Getter
@Setter
public class AccountEntity implements UserDetails {

    @Name
    private String id;

    /**
     * 账户信息(用户名)
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 编号
     */
    private String userNo;

    /**
     * 手机
     */
    private String mobile;

    /**
     * 状态
     */
    private String status;

    /**
     * 账号是否首次登录
     */
    private boolean firstLogin = false;

    /**
     * 账号是否未过期
     */
    private boolean accountNonExpired = true;

    /**
     * 账号是否未锁定
     */
    private boolean accountNonLocked = true;

    /**
     * 账号凭证是否未过期
     */
    private boolean credentialsNonExpired = true;

    /**
     * 账号是否可用
     */
    private boolean enabled = true;

    private String accountTypeId;

    @One(field = "accountTypeId")
    private DataDictionaryEntity accountType;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }
}
